<?php
namespace app\admin\controller;

use app\common\controller\Base;
use think\Request;
use think\Session;
use app\common\service\Fileware as FilewareService;
class Ueditor{
    public function ueditor(Request $request){
        $param = $request->param();

        $store = [];
        $store['filename']=$param['title'];
        $store['ext'] = trim($param['type'],'.');
        $store['size'] = $param['size'];
        $store['originname'] = $param['original'];
        $store['url'] = $param['url'];
        $store['from'] = 'ueditor';
        $this->save($store);

    }

    private function save($store){
        $filewareService = new FilewareService();
        $id = $filewareService->insert($store);
        return $id;
    }
}